package com.home.base.util;
import org.openqa.selenium.By;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.ie.InternetExplorerOptions;
import org.openqa.selenium.support.ui.Select;

import java.util.concurrent.TimeUnit;

/**
 * @author ：chenxf
 * @date ：Created in 2020/5/14 14:33
 * @description：
 * @modified By：
 * @version: $
 */
public class SeleniumIeUtil {

    public static void login(String username,String password){
        System.setProperty("webdriver.ie.driver",  "f://wb//360//IEDriverServer.exe");
        InternetExplorerOptions options=new InternetExplorerOptions();
        InternetExplorerDriver webDriver = new InternetExplorerDriver(options);



//        System.setProperty("webdriver.gecko.driver", "F://wb//geckodriver.exe");
//        WebDriver webDriver = new FirefoxDriver();
        //webDriver.manage().window().maximize();
       // webDriver.manage().deleteAllCookies();


        String url = "http://cbss.10010.com";
        webDriver.get(url); //
        // 与浏览器同步非常重要，必须等待浏览器加载完毕

//        webDriver.findElement(By.xpath("//img[@id='infoBlockIDImage']")).click();
//
//        webDriver.findElement(By.xpath("//a[@id='overridelink']")).click();

        webDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);


        webDriver.findElement(By.id("STAFF_ID")).sendKeys(username);
        webDriver.findElement(By.id("LOGIN_PASSWORD")).sendKeys(password);
        Select select = new Select(webDriver.findElement(By.id("LOGIN_PROVINCE_CODE")));
        select.selectByValue("83");
        System.out.println(webDriver.getPageSource());
        //webDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        System.out.println("this is close");
        try {
            Thread.sleep(10000*1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
    public static void main(String[] args) throws InterruptedException {
        SeleniumIeUtil.login("WG2472" ,"065782");
        // SeleniumUtil.loginYY("2085734124","ahqo4304");
        // SeleniumUtil.loginYY("2085741302","wdjm6414");
        //webDriver.get("http://www.yy.com/98187265/98187265");



    }
}
